package com.ruoyi.web.controller.ring;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ring.domain.RingMyOpinionImage;
import com.ruoyi.ring.service.IRingMyOpinionImageService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 我的意见反馈子Controller
 * 
 * @author liuwp
 * @date 2025-10-15
 */
@RestController
@RequestMapping("/ring/ring_my_opinion_image")
public class RingMyOpinionImageController extends BaseController
{
    @Resource
    private IRingMyOpinionImageService ringMyOpinionImageService;

    /**
     * 查询我的意见反馈子列表
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_my_opinion_image:list')")
    @GetMapping("/list")
    public TableDataInfo list(RingMyOpinionImage ringMyOpinionImage)
    {
        startPage();
        List<RingMyOpinionImage> list = ringMyOpinionImageService.selectRingMyOpinionImageList(ringMyOpinionImage);
        return getDataTable(list);
    }

    /**
     * 导出我的意见反馈子列表
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_my_opinion_image:export')")
    @Log(title = "我的意见反馈子", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RingMyOpinionImage ringMyOpinionImage)
    {
        List<RingMyOpinionImage> list = ringMyOpinionImageService.selectRingMyOpinionImageList(ringMyOpinionImage);
        ExcelUtil<RingMyOpinionImage> util = new ExcelUtil<RingMyOpinionImage>(RingMyOpinionImage.class);
        util.exportExcel(response, list, "我的意见反馈子数据");
    }

    /**
     * 获取我的意见反馈子详细信息
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_my_opinion_image:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ringMyOpinionImageService.selectRingMyOpinionImageById(id));
    }

    /**
     * 新增我的意见反馈子
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_my_opinion_image:add')")
    @Log(title = "我的意见反馈子", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RingMyOpinionImage ringMyOpinionImage)
    {
        return toAjax(ringMyOpinionImageService.insertRingMyOpinionImage(ringMyOpinionImage));
    }

    /**
     * 修改我的意见反馈子
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_my_opinion_image:edit')")
    @Log(title = "我的意见反馈子", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RingMyOpinionImage ringMyOpinionImage)
    {
        return toAjax(ringMyOpinionImageService.updateRingMyOpinionImage(ringMyOpinionImage));
    }

    /**
     * 删除我的意见反馈子
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_my_opinion_image:remove')")
    @Log(title = "我的意见反馈子", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ringMyOpinionImageService.deleteRingMyOpinionImageByIds(ids));
    }
}
